import os
import shutil

def rename(src,dst):
    for i,file in enumerate(os.listdir(src)):
        if(file.endswith(".jpg")):
            name = str(int(i/2)).zfill(12)
            print(file,i,name)
            srcPathJPG = os.path.join(src,file)
            srcPathTXT = os.path.join(src,file.replace(".jpg",".txt"))
            dstJPG = os.path.join(dst,name+".jpg")
            dstTXT = os.path.join(dst,name+".txt")

            shutil.copy(srcPathJPG,dstJPG)
            shutil.copy(srcPathTXT,dstTXT)

    print("Done")

def main():
    src = "/mnt/data/people/peopleslice/needRename"
    dst = "/mnt/data/people/peopleslice/renamed"
    rename(src,dst)

if __name__ == "__main__":
    main()